<?php
/**
 * Autor:   Miguel A. Zilli
 * Email:   miguelzilli@gmail.com
 */

class Pcultural extends AppModel {
    var $name = 'Pcultural';
    var $useTable = 'pculturales';
    var $primaryKey = 'id';
    var $displayField = 'nombre_cult';
    var $recursive = 0;
    var $order=array(
        'Pcultural.nombre_cult'=>'ASC'
    );

    var $belongsTo = array(
        'Quimico' => array(
            'className' => 'Quimico',
            'foreignKey' => 'quimico_id'
        ),
        'Produccion' => array(
            'className' => 'Produccion',
            'foreignKey' => 'produccion_id'
        ),
        'Revision' => array(
            'className' => 'Revision',
            'foreignKey' => 'revision_id'
        )
    );

    public function beforeSave(){
        if(!empty($this->data['Pcultural'])){
            foreach($this->data['Pcultural'] as $campo=>$valor){
                $this->data['Pcultural'][$campo]=strtoupper($valor);
            }
        }
        return true;
    }
}
?>